1. Field of the Invention
The present invention relates to inter-system communication in computer networks, and more particularly to a method for establishing communication by using a socket function in a network program.
2. Description of the Related Art
In order to establish inter-system communication in a computer network, a network program is generally used. The network program establishes communication by using a socket function which assigns sockets to each communication task. For example, a `bind ( )` system call is commonly used for assigning the socket.
Referring to FIG. 1, a computer network system which uses the `bind ( )` system call includes a server 10 and a plurality of clients 12 connected to the server 10. The server 10 is an independent computer system for processing job requests from clients 12. The clients 12 are also independent computer systems for requesting the server 10 to process a particular job. The inter-system communication between server 10 and the clients 12 is managed by a network program contained on both the server 10 and clients 12. In order to establish communication between server 10 and any one of clients 12, a socket function in the network program is used, and a socket is assigned to the specific communication task.
A prior art method for assigning a socket, by using the socket function in the network program, is illustrated in FIGS. 2 and 3. FIGS. 2 and 3 illustrate flow charts representing the process of assigning the socket by using the `bind ( )` system call (hereinafter, referred to as socket binding), with a connection-oriented protocol, and a connectionless protocol, respectively.
Referring to FIG. 2, with respect to a process for socket binding of a connection-oriented protocol, the server 10 and the client 12 specify a communication protocol type at steps 201 and 211, respectively socket ( )!. The server 10 assigns a unique name to an unnamed socket at step 202 bind ( )!. The server 10 notifies client 12 it is ready to accept a connection from the client, at step 203 listen ( )!, and waits to accept a substantial connection from the client 12, at step 204 accept ( )!. In the meantime, client 12 establishes a connection to the server 10 by using a socket descriptor at step 212 connect ( )!, and writes the request data by using the socket descriptor designated by the socket ( ), at step 213 write ( )!. Server 10 reads the request data by using the socket descriptor designated by the socket ( ) at step 205 read ( )!, and thereafter executes the process according to the data request. Once executed, server 10 writes reply data according to the process execution at step 206 write ( )!. Client 12 then reads the reply data from server 10, at step 214 read ( )!.
Next, referring to FIG. 3, with respect to the process for socket binding of a connectionless protocol, server 10 and client 12 specify a communication protocol type at steps 301 and 311, respectively socket ( )!. The server 10 and the client 12 assign a unique name to an unnamed socket at steps 302 and 312, respectively bind ( )!. The client 12 then sends the request data by using the socket descriptor designated by the socket ( ), at step 313 sendto ( )!. Server 10 receives the request data from client 12 by using the socket descriptor designated by the socket ( ), at step 303 recvfrom ( )!, and upon receipt, server 10 executes the process according to the request. Thereafter, the server 10 sends the reply data corresponding to the data request, at step 304 sendto ( )!. Client 12 receives the reply data from the server 10 at step 314 recvfrom ( )!.
If the `bind ( )` system call results in failure when assigning a unique name to an unnamed socket, the `bind ( )` system call will be retried immediately. However, if the `bind ( )` system call is repeatedly retried and continues to fail, a time delay is caused and a system call error will be generated during the time delay. The prior art method repeatedly retries the system call in case of system abnormalities. This retrying unnecessarily wastes system resources as well as increasing the load on the system.